import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { JVxeTypes, JVxeColumn } from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '编号',
    align: "center",
    dataIndex: 'schedulingSchemeCode'
  },
  {
    title: '名称',
    align: "center",
    dataIndex: 'schedulingSchemeName'
  },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'significantCondition',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "编码",
    field: "code",
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    label: "名称",
    field: "name",
    component: 'Input',
    colProps: { span: 8 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '规则名称',
    field: 'resourceAttribute',
    component: 'Input',
    slot: 'resourceAttributeSlot',
    colProps: {
      span: 6,
    },
  },
  {
    label: '分组编号',
    field: 'code',
    component: 'Input',
    colProps: {
      span: 6,
    },
  },
  {
    label: '归属部门ID',
    field: 'belongDepartmentName',
    component: 'JSelectDept',
    componentProps: ({}) => {
      return {
        multiple: false,
        showButton: false,
        checkable: false
      }
    },
    show: false,
    colProps: {
      span: 0,
    },
  },

  {
    label: '归属部门名称',
    field: 'belongDepartmentId',
    component: 'JSelectDept',
    componentProps: ({}) => {
      return {
        multiple: false,
        showButton: false,
        checkable: false
      }
    },
    colProps: {
      span: 12,
    },
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
    colProps: {
      span: 24,
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];
//子表单数据
//子表表格配置
export const itemColumns: JVxeColumn[] = [
  {
    title: '资源编号',
    key: 'associationCode',
    type: JVxeTypes.slot,
    width: "150px",
    placeholder: '请输入${title}',
    defaultValue: '',
    slotName: 'associationCodeSlot'
  },
  {
    title: '资源名称',
    key: 'associationName',
    type: JVxeTypes.input,
    width: "180px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '优先顺序',
    key: 'priority',
    type: JVxeTypes.input,
    placeholder: '请输入${title}',
    width: "180px",
    defaultValue: '',
  },
  {
    title: '加工工艺ID',
    key: 'processManagementId',
    type: JVxeTypes.hidden,
  },
  {
    title: '加工工艺',
    key: 'processManagementName',
    type: JVxeTypes.slot,
    width: "180px",
    placeholder: '请输入${title}',
    defaultValue: '',
    slotName: 'processNameSlot'
  },
  {
    title: '加工班组ID',
    key: 'useDepartmentId',
    type: JVxeTypes.hidden,
  },
  {
    title: '加工班组',
    key: 'useDepartmentName',
    type: JVxeTypes.slot,
    width: "180px",
    placeholder: '请输入${title}',
    defaultValue: '',
    slotName: 'useDepartmentNameSlot'
  },
  {
    title: '是否专用',
    key: 'specialPurpose',
    type: JVxeTypes.select,
    placeholder: '请输入${title}',
    defaultValue: 1,
    width: "180px",
    options: [{ value: 0, label: '否' }, { value: 1, label: '是' }]
  },
  {
    title: '工作时长',
    key: 'workHours',
    type: JVxeTypes.input,
    placeholder: '请输入${title}',
    width: "180px",
    defaultValue: '',
  }
]


export const rules = {
  name: [
    { required: true, message: '资源名称必填', trigger: 'blur' },
  ],
  code: [{ required: true, message: '资源编码必填', trigger: 'change' }],
  resourceAttribute: [
    {
      required: true,
      message: '资源属性必填',
      trigger: 'change',
    },
  ],
  belongDepartmentName: [
    {
      required: true,
      message: '归属部门必填',
      trigger: 'change',
    },
  ]
}
